package com.jdrx.sw.sewage.api.web;

import com.jdrx.platform.commons.rest.beans.vo.ResponseVO;
import com.jdrx.platform.commons.rest.exception.BizException;
import com.jdrx.platform.commons.rest.factory.ResponseFactory2;
import com.jdrx.sw.sewage.beans.vo.GISStationInfoVO;
import com.jdrx.sw.sewage.beans.vo.GISStationVO;
import com.jdrx.sw.sewage.common.constant.Constant;
import com.jdrx.sw.sewage.service.StationServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/api/stationgis")
@Api(value = "厂站管理-GIS")
public class StationGISApi {
    @Autowired
    private StationServiceImpl stationServiceImpl;

    @ApiOperation(value = "GIS站点列表查询")
    @RequestMapping(value = "selectGisStationList", method = RequestMethod.POST)
    public ResponseVO<List<GISStationVO>> selectGisStationList(@RequestHeader(Constant.DATA_NODE) String dataNode,
                                                               @RequestHeader(Constant.TENANT_ID) String tenantId,
                                                               @RequestBody List<Long> dutyUserStationIds) {
        return ResponseFactory2.ok(stationServiceImpl.selectGisStationList(dutyUserStationIds, dataNode));
    }

    @ApiOperation(value = "GIS站点详情信息查询")
    @RequestMapping(value = "selectGisStationInfo", method = RequestMethod.GET)
    public ResponseVO<GISStationInfoVO> selectGisStationInfo(@RequestHeader(Constant.DATA_NODE) String dataNode,
                                                             @RequestHeader(Constant.TENANT_ID) String tenantId,
                                                             @RequestParam Long stationId) throws BizException {
        return ResponseFactory2.ok(stationServiceImpl.selectGisStationInfo(stationId));
    }
}
